From: Florian Müllner Date: Tue, 8 Oct 2019 18:42:20 +0000 (+0200) Subject: Revert "windowManager: Use new reorder_workspace() API" X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~811^2^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3d39b32a0b65da23d3e6e1513bd7388afdf0e87a;p=gnome-shell.git Revert "windowManager: Use new reorder_workspace() API" It's too easy to break, so revert to the old code until we figure out a fix. This reverts commit ff9bb5399b1d22fceaf00c9fc8e0058f24af96cc. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1497 --- diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index ff2f08964..c9e48e7a3 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1212,9 +1212,41 @@ var WindowManager = class { if (!Meta.prefs_get_dynamic_workspaces()) return; - let newWs = workspaceManager.append_new_workspace( - false, global.get_current_time()); - workspaceManager.reorder_workspace(newWs, pos); + workspaceManager.append_new_workspace(false, global.get_current_time()); + + let windows = global.get_window_actors().map(a => a.meta_window); + + // To create a new workspace, we slide all the windows on workspaces + // below us to the next workspace, leaving a blank workspace for us + // to recycle. + windows.forEach(window => { + // If the window is attached to an ancestor, we don't need/want + // to move it + if (window.get_transient_for() != null) + return; + // Same for OR windows + if (window.is_override_redirect()) + return; + // Sticky windows don't need moving, in fact moving would + // unstick them + if (window.on_all_workspaces) + return; + // Windows on workspaces below pos don't need moving + let index = window.get_workspace().index(); + if (index < pos) + return; + window.change_workspace_by_index(index + 1, true); + }); + + // If the new workspace was inserted before the active workspace, + // activate the workspace to which its windows went + let activeIndex = workspaceManager.get_active_workspace_index(); + if (activeIndex >= pos) { + let newWs = workspaceManager.get_workspace_by_index(activeIndex + 1); + this._blockAnimations = true; + newWs.activate(global.get_current_time()); + this._blockAnimations = false; + } } keepWorkspaceAlive(workspace, duration) {